<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/common.css"/>
		<link rel="stylesheet" type="text/css" href="../css/reset_pwd.css"/>
	</head>
	<body>
		<form action="" method="post" id="form" class="search_box">
			<div>
				<span>旧&nbsp;&nbsp;&nbsp;密&nbsp;&nbsp;&nbsp;码：</span>
				<input type="password" name="password" placeholder="请输入旧密码" />
			</div>
			<div>
				<span>新&nbsp;&nbsp;&nbsp;密&nbsp;&nbsp;&nbsp;码：</span>
				<input type="password" name="newPassword" placeholder="请输入新密码" />
			</div>
			<div>
				<span>重复新密码：</span>
				<input type="password" name="newPassword2" placeholder="请重复新密码" />
			</div>
			<button type="submit">提交</button>
		</form>

		<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../layui/layui.js"></script>
		<script type="text/javascript">
			jQuery.browser = {};
			(function() {
				jQuery.browser.msie = false;
				jQuery.browser.version = 0;
				if(navigator.userAgent.match(/MSIE ([0-9]+)./)) {
					jQuery.browser.msie = true;
					jQuery.browser.version = RegExp.$1;
				}
			})();
			$(document).ready(function() {

				$('#form').submit(function(e) {
					$.ajax({
						type: "POST",
						url: "/user/user/pwd",
						data: new FormData($(this)[0]), // serializes the form's elements.
						cache: false,
						contentType: false,
						processData: false,
						success: function(data) {
							if(data) {
								var rel = data.rel;
								if(rel){
									layui.use('layer', function() {
										var layer = layui.layer;

										layer.msg(data.msg, {
											icon: 6
										});
									});
								} else {
									layui.use('layer', function() {
										var layer = layui.layer;
										layer.msg(data.msg, {
											icon: 5
										})
									})
								}

							} else {
								// alert("登陆失败");
								layui.use('layer', function() {
									var layer = layui.layer;
									layer.msg('保存失败', {
										icon: 5
									})
								})
							}

						}
					});
					e.preventDefault();
				});
			});

			document.onkeydown = function(event){
				var e = event || window.event || arguments.callee.caller.arguments[0];
				if(e && e.keyCode == 116){
					event.preventDefault();

					$(window.parent.$('.showIframe').each(function(){
						if(!$(this).hasClass('hideIframe')){
							$(this).children('iframe').attr('src',$(this).children('iframe').attr('src'))
						}
					}))
				}
			}
		</script>
	</body>
</html>
